package com.example.teesystem.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 *
 * @TableName t_assistant
 */
@TableName(value="t_assistant")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Assistant implements Serializable {

    /**
     *  课程助教ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 课程id
     */
    private Integer courseId;

    /**
     * 助教ID
     */
    private Integer assistantId;

    /**
     * 助教权限
     */
    private long permission;

    /**
     * 创建教师ID
     */
    @TableField(fill = FieldFill.INSERT)
    private Integer uploadId;

    /**
     * 添加时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 是否已经删除
     */
    @TableLogic
    private Integer isDelete;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public Assistant(User user){
        this.uploadId = user.getId();
    }

}
